package com.example.shirotest.console;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("Maingeter")
public class Maingeter {

    @Autowired
    GetRemoteData getRemoteData;

    //执行爬虫任务
    public void runGeter(){
        if(getRemoteData.getIsRuning())return;
        getRemoteData.start();

        new Product("P1",getRemoteData).start();

        new Consumer("T1",getRemoteData).start();
        new Consumer("T2",getRemoteData).start();
        new Consumer("T3",getRemoteData).start();
        new Consumer("T4",getRemoteData).start();
        new Consumer("T5",getRemoteData).start();
    }

    //清空缓存
    public void clearUniqueMap(){
        getRemoteData.clearUniqueMap();
    }

}
